package com.test4;


import com.test2.service.UserService;
import com.test2.service.UserServiceImpl;

public class Client {

    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userServiceImpl = new UserServiceImpl();
        //代理角色
        ProxyInvocationHandler pih = new ProxyInvocationHandler();
        //通过调用程序处理角色来处理我们要调用的接口对象！
        pih.setTarget(userServiceImpl);
        //动态生成代理类
        UserService proxy = (UserService)pih.getProxy();
        proxy.add();
        proxy.delete();
    }
}
